<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h1>{{msg}}</h1>

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
      var vm = new Vue({
        el: "#app",
        data: {
          msg: "vue",
        },
        methods: {},
        async mounted(){
            let url1 = 'http://www.liulongbin.top:3006/api/cmtlist'
             // 方式一
            //  fetch(url1)
            //  .then(res=>{
            //      return res.json()
            //  })
            //  .then(res=>{
            //      console.log(res);
            //  })
            // 方式一

            fetch(url1)
            .then(res=>res.json())
            .then(res=>{console.log(res)})
            let getreuslt = await fetch(url1).then(res => res,json())
            console.log(getreuslt);

            let url2 = 'http://www.liulongbin.top:3006/api/addcmt'

            let postresult = await fetch(url2,{
                method:'post',
                body:JSON.stringify({username:11,content:'嘎嘎'}),
                headers:{
                    'content-type':'application/json'
                },
            }).then(res=>res.json())

            console.log(postresult);

            let url3='https://locally.uieee.com/categories/1/shops?_page=1&_limit=20'
            let getParamsRes=await fetch(url3).then(res=>res.json())

            console.log(getParamsRes);
        }
      });
    </script>
  </body>
</html>
